<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>EOS.IO: Tic Tac Toe Contract</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#namespaces">Namespaces</a>  </div>
  <div class="headertitle">
<div class="title">Tic Tac Toe Contract<div class="ingroups"><a class="el" href="group__examplecontract.html">Example Contract</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Defines the PvP tic tac toe contract example.  
<a href="#details">More...</a></p>
<div class="dynheader">
Collaboration diagram for Tic Tac Toe Contract:</div>
<div class="dyncontent">
<center><table><tr><td><img src="group__tictactoecontract.png" border="0" alt="" usemap="#group____tictactoecontract"/>
<map name="group____tictactoecontract" id="group____tictactoecontract">
<area shape="rect" id="node1" href="group__examplecontract.html" title="Example Contract. " alt="" coords="5,5,132,32"/>
</map>
</td></tr></table></center>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacetic__tac__toe"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacetic__tac__toe.html">tic_tac_toe</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>For the following tic-tac-toe game:</p><ul>
<li>Each pair of player can have 2 unique game, one where player_1 become host and player_2 become challenger and vice versa</li>
<li>The game data is stored in the "host" scope and use the "challenger" as the key</li>
</ul>
<p>(0,0) coordinate is on the top left corner of the board </p><div class="fragment"><div class="line">               (0,2)</div><div class="line">(0,0) -  |  o  |  x      where - = empty cell</div><div class="line">      -  |  x  |  -            x = move by host</div><div class="line">(2,0) x  |  o  |  o            o = move by challenger</div></div><!-- fragment --><p>Board is represented with number:</p><ul>
<li>0 represents empty cell</li>
<li>1 represents cell filled by host</li>
<li>2 represents cell filled by challenger Therefore, assuming x is host, the above board will have the following representation: [0, 2, 1, 0, 1, 0, 1, 2, 2] inside the game object</li>
</ul>
<p>In order to deploy this contract:</p><ul>
<li>Create an account called tic.tac.toe</li>
<li>Add tic.tac.toe key to your wallet</li>
<li>Set the contract on the tic.tac.toe account</li>
</ul>
<p>How to play the game:</p><ul>
<li>Create a game using <code>create</code> action, with you as the host and other account as the challenger.</li>
<li>The first move needs to be done by the host, use the <code>move</code> action to make a move by specifying which row and column to fill.</li>
<li>Then ask the challenger to make a move, after that it's back to the host turn again, repeat until the winner is determined.</li>
<li>If you want to restart the game, use the <code>restart</code> action</li>
<li>If you want to clear the game from the database to save up some space after the game has ended, use the <code>close</code> action </li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
